<template>
  <div>
    <el-form :inline="true" :model="client" class="demo-form-inline">
      <el-form-item label="客户名称">
        <el-input v-model="client.clientName" placeholder="请输入客户名称"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input show-password v-model="client.clientPassword" placeholder="请输入密码"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="login()">登录</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "ClientLoginView",
  data() {
    return {
      client:{},
    }
  }, methods: {
    login(){
      this.axios.post("http://localhost:8000/carservice/CarLogin/login",this.client).then(res=>{
         if(res.data.code==200){
             this.$message.success(res.data.msg);
             sessionStorage.setItem("clientName",res.data.data.clientName);
             sessionStorage.setItem("token",res.data.data.token);
             sessionStorage.setItem("clientId",res.data.data.clientId);
             sessionStorage.setItem("password",res.data.data.clientPassword)
             location.href="/planList";
         }else {
             this.$message.error(res.data.msg);
         }
      })

    }
  }, created() {
    //4钩子函数
  }
}
</script>

<style scoped>

</style>